using System;
using System.Collections.Generic;
using System.Text;
using Google.GData.Calendar;
using Google.GData.Client;
using Google.GData.Extensions;

namespace GCalSync.Core
{
    class GoogleAppointments : List<EventEntry>
    {

        /// <summary>
        /// Create collection of appointments from google.
        /// </summary>
        /// <param name="entries">AtomEntryCollection which contains appointment items. </param>
        public GoogleAppointments(AtomEntryCollection entries)
        {
            foreach (EventEntry googleEvent in entries)
            {
                this.Add(googleEvent);
            }
        }


        /// <summary>
        /// Get by google ID
        /// </summary>
        /// <param name="id">Google ID to look for</param>
        /// <returns></returns>
        public EventEntry GetById(string id)
        {
            foreach (EventEntry ge in this)
                if (ge.Id.AbsoluteUri == id)
                    return ge;

            return null;
        }
    }
}
